package com.fuyu.web.admin.config;

import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * swagger配置
 */
@Configuration
@EnableKnife4j
public class SwaggerConfiguration {

    @Bean
    public GroupedOpenApi adminApi() {
        return GroupedOpenApi.builder()
                .group("admin-api")
                //.pathsToMatch("/admin/**")
                .packagesToScan("com.fuyu")
                .build();
    }

    @Bean
    public OpenAPI springShopOpenAPI() {
        OpenAPI openAPI = new OpenAPI();
        openAPI.info(getInfo());
        return openAPI;
    }


    public Info getInfo() {
        return new Info()
                .title("open-ms")
                .description("开放平台")
                .version("v1")
                .license(new License()
                        .name("Apache 2.0")
                        .url("http://springdoc.org")
                );
    }
}
